package bio.five;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.net.Socket;
import java.util.Scanner;

/*
    处理客户端接收消息的线程
 */
public class HandlerClientAcceptThread extends Thread {
    private Socket socket;

    public HandlerClientAcceptThread(Socket socket) {
        this.socket = socket;
    }

    @Override
    public void run() {
        try (
                //接收消息
                BufferedReader br = new BufferedReader(new InputStreamReader(socket.getInputStream()));
        ) {
            String msg = "";
            while ((msg = br.readLine()) != null) {
                System.out.println(msg);
            }
        } catch (Exception e) {

        }
    }
}
